﻿#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

//25.合并有序数组
int main()
{
	int arr1[30] = { 0 };
	int arr2[30] = { 0 };
	int arr3[60] = { 0 };
	int n = 0, m = 0;
	scanf("%d %d", &n, &m);
	int i = 0;
	for (i = 0; i < n; i++)
	{
		scanf("%d", &arr1[i]);
	}
	for (i = 0; i < m; i++)
	{
		scanf("%d", &arr2[i]);
	}
	i = 0;
	int j = 0;
	int k = 0;
	//合并两个数组到arr3
	while (i < n && j < m)
	{
		if (arr1[i] < arr2[j])
		{
			arr3[k] = arr1[i];
			i++;
			k++;
		}
		else
		{
			arr3[k] = arr2[j];
			k++;
			j++;
		}
	}
	//若i越界，则arr1所有元素已经存入arr3
	//arr2中有剩余元素，存入arr3
	if (i == n)
	{
		for (; j < m; j++)
		{
			arr3[k] = arr2[j];
			k++;
		}
	}
	//若j越界，则arr2所有元素已经存入arr3
	//arr1中有剩余元素，存入arr3
	if (j == m)
	{
		for (; i < n; i++)
		{
			arr3[k] = arr1[i];
			k++;
		}
	}
	//打印
	for (k = 0; k < m + n; k++)
	{
		printf("%d ", arr3[k]);
	}
	return 0;
}


//26.两整数相加
int sum(int num1, int num2)
{
    return num1 + num2;
}


//27.猜数字
int game(int* guess, int guessSize, int* answer, int answerSize) 
{
	int i = 0;
	int count = 0;
	for (i = 0; i < guessSize; i++)
	{
		if (guess[i] == answer[i])
		{
			count++;
		}
	}
	return count;
}


//28.温度转换
double* convertTemperature(double celsius, int* returnSize) 
{
	//利⽤malloc函数为ans数组分配空间(2个double类型所需的内存)
    //这⾥需要将void*类型强制转化为double*类型
	double* ans = (double*)malloc(2 * sizeof(double));
	ans[0] = celsius + 273.15;
	ans[1] = celsius * 1.80 + 32.00;
	*returnSize = 2;
	return ans;
}


//29.最⼩偶倍数
int smallestEvenMultiple(int n)
{
	if (n % 2 == 0)
	{
		return n;
	}
	else
	{
		return 2 * n;
	}
}